﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages"
    Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CreateCommitteeUserControl.ascx.cs"
    Inherits="JM.JCY.SharePointComponent.Committee.CreateCommittee.CreateCommitteeUserControl" %>
<style type="text/css">
    form.cmxform
    {
        width: 50em;
    }
    em.error
    {
        background: url("/_layouts/JM.JCY.Resource/images/unchecked.gif") no-repeat 0px 0px;
        padding-left: 16px;
    }
    em.success
    {
        background: url("/_layouts/JM.JCY.Resource/images/checked.gif") no-repeat 0px 0px;
        padding-left: 16px;
    }
    
    form.cmxform label.error
    {
        margin-left: auto;
        width: 250px;
    }
    em.error
    {
        color: black;
    }
    #warning
    {
        display: none;
    }
    
    table.ms-rtetoolbarmenu
    {
        width: 100%;
    }
    
    iframe.ms-rtelong
    {
        width: 100%;
    }
    .style1
    {
        height: 20px;
    }
    
    .countLabel
    {
        color: Gray;
        font-style: italic;
    }
    
    .storageBox
    {
        display: none;
    }
    
    .copiedOption
    {
        background-color: Yellow;
    }
</style>
<script src="/_layouts/JM.JCY.Resource/scripts/jQuery.dualListBox-1.3.js" language="javascript"
    type="text/javascript"></script>
<script language="javascript" type="text/javascript">


    function IsExistCommitteeName(sender, args) {
        var committeeName = $("#<%= txtName.ClientID %>").val();
        $.support.cors = true;
        $.ajax({
            //async: false,
            type: "GET",
            url: UserManagementServiceUrl + "IsExistCommittee?committeeName=" + committeeName,
            contentType: "application/json; charset=utf-8",
            dataType: 'jsonp',
            cache: false,
            success: function (result) {
                if (result > 0) {
                    args.IsValid = false;
                    $("#<%= hfExist.ClientID %>").val("true");
                    $("#<%= cvCategory.ClientID %>").show();
                }
                else {
                    args.IsValid = true;
                    $("#<%= hfExist.ClientID %>").val("false");
                    $("#<%= cvCategory.ClientID %>").hide();
                }
            },
            failure: function (msg) {
                alert(msg);
            }

        });
    }


    function getClientId() {
        var paraId1 = '<%= box1View.ClientID %>';
        var paraId2 = '<%= box2View.ClientID %>';
        return { Id1: paraId1, Id2: paraId2 };
    }


    $(function () {

        $.configureBoxes();

    });

    function CheckPageValid() {
        var valid = true;

        if (trim($("#<%= txtName.ClientID %>").val()) == "") {
            $("#<%= rfCategory.ClientID %>").show();
            valid = false;
        }
        else
            $("#<%= rfCategory.ClientID %>").hide();

        if ($("#<%= hfExist.ClientID %>").val() == "true") {
            $("#<%= cvCategory.ClientID %>").show();
            valid = false;
        }
        return valid;
    }

</script>
<div>
    <table class="main">
        <tr>
            <td valign="top" runat="server" id="tdContent">
                <table class="content" width="98%">
                    <tr>
                        <td style="padding: 5px;">
                            <table width="100%" class="title">
                                <tr>
                                    <td width="60%">
                                        <h2 class="title">
                                            创建专题小组</h2>
                                    </td>
                                    <td align="right" width="40%">
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <table width="100%" class="form">
                                <tr>
                                    <td>
                                        <b>名称</b> <span class="mandatory">*</span>
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtName" runat="server" Width="480" MaxLength="100">
                                        </asp:TextBox>
                                        <asp:RequiredFieldValidator ID="rfCategory" runat="server" ErrorMessage="请输入一个专题小组名称."
                                            ValidationGroup="SaveInfo" ControlToValidate="txtName" CssClass="ms-formvalidation"
                                            Display="Dynamic"></asp:RequiredFieldValidator>
                                        <asp:CustomValidator ID="cvCategory" runat="server" ErrorMessage="该专题小组已经存在." ValidationGroup="SaveInfo"
                                            ControlToValidate="txtName" CssClass="ms-formvalidation" Display="Dynamic" ClientValidationFunction="IsExistCommitteeName"></asp:CustomValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>描述</b> <span class="mandatory">*</span>
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtDesc" runat="server" TextMode="MultiLine" Rows="8" Columns="66"
                                            MaxLength="200"></asp:TextBox>
                                        </asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <b>添加成员</b> <span class="mandatory">*</span>
                                    </td>
                                    <td>
                                        :
                                    </td>
                                    <td>
                                        <table width="100%" border="0">
                                            <tr>
                                                <td width="40%" valign="bottom" style='padding-left: 0px; padding-right: 0px' class="style1">
                                                    所有人员
                                                </td>
                                                <td width="20%" style='padding-left: 0px; padding-right: 0px' class="style1">
                                                    &nbsp;
                                                </td>
                                                <td valign="bottom" width="40%" style='padding-left: 0px; padding-right: 0px' class="style1">
                                                    添加人员
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style='padding-left: 0px; padding-right: 0px'>
                                                  
                                                    <input type="text" id="box1Filter" style="width: 100%" />
                                                    <select runat="server" id="box1View" multiple="true" style="height: 150px; width: 100%;">
                                                    </select><br />
                                                    <span id="box1Counter" class="countLabel"></span>
                                                    <select id="box1Storage">
                                                    </select>
                                                </td>
                                                <td valign="bottom" align="center" style='padding-left: 0px; padding-right: 0px'>
                                                    <table>
                                                        <tr>
                                                            <td>
                                                                <button id="allTo2" type="button">
                                                                    &nbsp;>>&nbsp;</button>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <button id="allTo1" type="button">
                                                                    &nbsp;<<&nbsp;</button>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                                <td style='padding-left: 0px; padding-right: 0px'>
                                                   
                                                    <input type="text" id="box2Filter" style="width: 100%" /><br />
                                                    <select name="box2View" runat="server" id="box2View" multiple="true" style="width: 100%; height: 150px">
                                                    </select><br />
                                                    <br />
                                                    <span id="box2Counter" class="countLabel"></span>
                                                    <select id="box2Storage">
                                                    </select>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="3" class="button" align="right">
                                        <asp:ImageButton ID="imgSavePublish" runat="server" ImageUrl="~/_layouts/JM.JCY.Resource/images/save.png"
                                            OnClick="imgSavePublish_Click" OnClientClick="if(CheckPageValid()==false)return false;" />
                                        <asp:ImageButton ID="imgCancel" runat="server" 
                                            ImageUrl="~/_layouts/JM.JCY.Resource/images/cancel.png" onclick="imgCancel_Click"
                                        />
                                          
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<asp:HiddenField ID="hfExist" runat="server" />

